package com.onesports.intelligent.k12.polarlight.controller.operation;

import cn.oneframework.common.utils.ResultUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.onesports.intelligent.k12.polarlight.constant.ApiPathConstants;
import com.onesports.intelligent.k12.polarlight.domain.dto.operation.OperationCoachCourseDTO;
import com.onesports.intelligent.k12.polarlight.domain.dto.operation.PageOperationCoachDTO;
import com.onesports.intelligent.k12.polarlight.domain.vo.course.CourseScheduleDetailVO;
import com.onesports.intelligent.k12.polarlight.domain.vo.operation.PageOperationCoachVO;
import com.onesports.intelligent.k12.polarlight.service.coach.CoachService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * @author wangcx
 * @since 2022-7-12
 */
@Api(value = "运营端", tags = "运营端-教练管理")
@PreAuthorize("isAuthenticated()")
@RestController
@RequestMapping(ApiPathConstants.OPERATION_COACH)
@RequiredArgsConstructor
public class OperationCoachController {

    private final CoachService service;


    @GetMapping("/get-course")
    @ApiOperation(value = "查看排课表", response = CourseScheduleDetailVO.class)
    public ResponseEntity<List<CourseScheduleDetailVO>> getCourse(@Valid OperationCoachCourseDTO dto) {
        return ResultUtil.success(service.getCourse(dto));

    }

    @GetMapping("/page")
    @ApiOperation(value = "运营端分页查询教练")
    public ResponseEntity<IPage<PageOperationCoachVO>> page(@Valid PageOperationCoachDTO dto) {
        return ResultUtil.success(this.service.operationPage(new Page<>(dto.getPage(), dto.getRow()), dto));
    }



}